libkovan
1
The kovan standard library
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
geom.hpp
Go to the documentation of this file.
1
#ifndef _GEOM_HPP_
2
#define _GEOM_HPP_
3
4
#include "
geom.h
"
5
#include "
export.h
"
6
7
template
<
typename
T>
8
class
EXPORT_SYM
Point2
9
{
10
public
:
11
Point2
(
const
T& x,
const
T &y)
12
: m_x(x),
13
m_y(y)
14
{
15
}
16
17
const
T &
x
()
const
18
{
19
return
m_x;
20
}
21
22
const
T &
y
()
const
23
{
24
return
m_y;
25
}
26
27
void
setX
(
const
T &x)
28
{
29
m_x = x;
30
}
31
32
void
setY
(
const
T &y)
33
{
34
m_y = y;
35
}
36
37
point2
toCPoint2
()
const
38
{
39
return
create_point2
(m_x, m_y);
40
}
41
42
private
:
43
T m_x;
44
T m_y;
45
};
46
47
template
<
typename
T>
48
class
EXPORT_SYM
Rect
49
{
50
public
:
51
Rect
(
const
T &x,
const
T &y,
const
T &width,
const
T &height)
52
: m_x(x),
53
m_y(y),
54
m_width(width),
55
m_height(height)
56
{
57
}
58
59
const
T &
x
()
const
60
{
61
return
m_x;
62
}
63
64
const
T &
y
()
const
65
{
66
return
m_y;
67
}
68
69
const
T &
width
()
const
70
{
71
return
m_width;
72
}
73
74
const
T &
height
()
const
75
{
76
return
m_height;
77
}
78
79
Point2<T>
center
()
const
80
{
81
return
Point2<T>
(m_x + m_width / 2, m_y + m_height / 2);
82
}
83
84
void
setX
(
const
T &x)
85
{
86
m_x = x;
87
}
88
89
void
setY
(
const
T &y)
90
{
91
m_y = y;
92
}
93
94
void
setWidth
(
const
T &width)
95
{
96
m_width = width;
97
}
98
99
void
setHeight
(
const
T &height)
100
{
101
m_x = height;
102
}
103
104
T
area
()
const
105
{
106
return
m_width * m_height;
107
}
108
109
rectangle
toCRectangle
()
const
110
{
111
return
create_rectangle
(m_x, m_y, m_width, m_height);
112
}
113
114
private
:
115
T m_x;
116
T m_y;
117
T m_width;
118
T m_height;
119
};
120
121
#endif
include
kovan
geom.hpp
Generated on Mon Aug 19 2013 00:33:00 for libkovan by
1.8.4